package com.emagic.manage.navigation;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.emagic.manage.modules.loginmodule.activity.LoginActivity;
import com.emagic.manage.modules.main.activity.MainActivityNew;
import com.emagic.manage.modules.room.activity.RoomActivity;
import com.emagic.manage.modules.room.activity.TRoomActivity;
import com.emagic.manage.modules.room.activity.TRoomActivityOne;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * 全局单例对象,用于应用程序页面跳转
 *
 * @author baoy
 * @version 1.0
 *          Create by 15/12/15 下午1:51
 */
@Singleton
public class Navigator {

    @Inject
    public Navigator() {
    }

    public void navigateToLoginActivity(Context context, String nickName) {
        if (context != null) {
            Intent intentToLaunch = LoginActivity.getCallingIntent(context, nickName);
            context.startActivity(intentToLaunch);
        }
    }

    public void navigateToMain(Context context) {
        if (context != null) {
            Intent intentToLaunch = MainActivityNew.getCallingIntent(context);
            context.startActivity(intentToLaunch);
        }
    }

    public void navigateToRoomActivity(Activity context, String serial, String chairmanpwd,
                                       String confuserpwd, String classname, String roomtype, int code) {
        if (context != null) {
            Intent intentToLaunch = RoomActivity.getCallingIntent(context, serial, chairmanpwd, confuserpwd, classname, roomtype);
            context.startActivityForResult(intentToLaunch, code);
        }
    }

    public void navigateToTRoomActivity(Activity context, String serial, String chairmanpwd,
                                        String confuserpwd, String classname, int code) {
        if (context != null) {
            Intent intentToLaunch = TRoomActivity.getCallingIntent(context, serial, chairmanpwd, confuserpwd, classname);
            context.startActivityForResult(intentToLaunch, code);
        }
    }

    public void navigateToTRoomOneActivity(Activity context, String serial, String chairmanpwd,
                                           String confuserpwd, String classname, int code) {
        if (context != null) {
            Intent intentToLaunch = TRoomActivityOne.getCallingIntent(context, serial, chairmanpwd, confuserpwd, classname);
            context.startActivityForResult(intentToLaunch, code);
        }
    }
}
